<?php

require_once dirname(__FILE__).'/../lib/adsesGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/adsesGeneratorHelper.class.php';

/**
 * adses actions.
 *
 * @package    ndirou_affaire
 * @subpackage adses
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class adsesActions extends autoAdsesActions
{

	public function executeActiverAds(sfWebRequest $request){
		// activer l'annonce
		$ads = $this->getRoute()->getObject();
		if ($ads){
			$ads->changeStatus();
		}

		// envoi de mail a l'annonceur
		$this->dispatcher->notify(new sfEvent($this, 'admin.activeAds',array( 
            'ads' => $ads, 
        )));

		$this->redirect('@homepage');
	}

	public function executeDesactiverAds(sfWebRequest $request){
		// desactiver l'annonce
		$ads = $this->getRoute()->getObject();
		if ($ads){
			$ads->changeStatus();
		}

		$this->redirect('@homepage');
	}
}
